//
//  Config.h
//  myFramework
//
//  Created by eason on 16/4/20.
//  Copyright © 2016年 普惠. All rights reserved.
//

#import "ApiResponse.h"

#ifndef Config_h
#define Config_h

//定义返回请求数据的block类型
typedef void (^SuccessBlock) (id response);
typedef void (^ErrorBlock) (id errorCode, id errorMsg);
typedef void (^FailureBlock)();

//定义返回请求数据的block类型
typedef void (^ReturnValueBlock) (id response, id returnValue);
typedef void (^ErrorCodeBlock) (id errorCode, id errorMsg);
typedef void (^FailureBlock)();
typedef void (^NetWorkBlock)(BOOL netConnetState);


#define IOS_VERSION                 [[[UIDevice currentDevice] systemVersion] floatValue]       //设备系统版本
//屏幕宽度和高度
#define gScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define gScreenHeight ([UIScreen mainScreen].bounds.size.height)

//设备类型
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define ToolBarHeight               49
#define kNavigationBarHeight        64
#define kStatusBarHeight            ((IOS_VERSION >= 7.0f) ? 0.0f : 20.0f)

#define CREATECOLOR(r,g,b,a)        [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
#define isIPAD                      (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

#if DEBUG==1
#define NSLogDebug(fmt,...) NSLog( @"info:%s.%d "fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define NSLogDebug(fmt,...) //NSLog( @"info:%s.%d "fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif


//Log错误信息
#define NSLogError(fmt,...) NSLog( @"error:%s.%d "fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
//Log异常信息
#define NSLogWarn(fmt,...) NSLog( @"warn:%s.%d "fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)

#endif /* Config_h */
